import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: "/home",
        redirect: "/home/homes"
      },
      {
        // path: "/home/homes"
        path: "homes",
        component: () => import(/* webpackChunkName: "homes" */ '../views/home/Homes.vue')
      },
      {
        path: "classify",
        component: () => import(/* webpackChunkName: "classify" */ '../views/home/Classify.vue')
      },
      {
        path: "car",
        component: () => import(/* webpackChunkName: "car" */ '../views/home/Car.vue')
      },
      {
        path: "my",
        component: () => import(/* webpackChunkName: "my" */ '../views/home/My.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
